home *** CD-ROM | disk | FTP | other *** search
- function attack()
- {
- var _loc3_ = _parent.attachMovie("rays","rays" + _parent.getNextHighestDepth(),_parent.getNextHighestDepth());
- _loc3_.angle = this._rotation;
- _parent.globalToLocal(point);
- trace(point.x);
- _loc3_._x = point.x;
- _loc3_._y = point.y;
- _loc3_.target = target;
- _loc3_.onEnterFrame = function()
- {
- this._x -= 5 * Math.cos(this.angle * 3.141592653589793 / 180);
- this._y -= 5 * Math.sin(this.angle * 3.141592653589793 / 180);
- this._rotation = this.angle + 90;
- if(this._x > 400 || this._x < -400 || this._y < -300 || this._y > 300)
- {
- this.removeMovieClip();
- }
- if(this.hitTest(target))
- {
- target.health = 0;
- this.removeMovieClip();
- }
- };
- }
- var target;
- var attackRate = 25;
- var timer = 0;
- var health = 100;
- onEnterFrame = function()
- {
- if(_root.userCar == "")
- {
- target = _parent.valet_mc;
- }
- else
- {
- target = _parent[_root.userCar];
- }
- this._rotation = Math.atan2(this._y - target._y,this._x - target._x) * 180 / 3.141592653589793;
- if(_currentframe == 1)
- {
- gotoAndStop(3);
- }
- if(_root.userCar != "")
- {
- if(this.hitTest(target) && this._currentframe != _totalframes)
- {
- this.health -= 20;
- if(this.health <= 0)
- {
- this.gotoAndStop(_totalframes);
- }
- }
- }
- };
-